﻿// code03050303.cpp : 数组
// 指针运算

#include <iostream>
using namespace std;


int main()
{
    constexpr size_t sz = 5;
    int arr[sz] = { 1,2,3,4,5 };
    int* p = arr;                //等价与int*p=&arr[0]
    int* p2 = arr + 4;           //&a[4]

    int* p3 = arr + sz;         //sz是常量，等价&a[5],尾后指针
    int* p4 = arr + 10;         //报错！溢出，arr只有5个元素

    auto n = end(arr) - begin(arr);

    int* b = begin(arr);
    int* e = end(arr);
    while (b !=e)
    {
        cout << *b << " ";
        ++b;        
    }
    return 0;
}


